#!/bin/sh
#
# Slackware build script for google-desktop (binary repackaging)

# Copyright 2006 Ricardson Williams <ricardsonwilliams at yahoo.com.br>
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# Modified by Robby Workman - no additional license terms added.

PRGNAM=google-desktop
VERSION=1.0.1.0060
ARCH=i386		# The binary is built for i386 
BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $PKG || exit 1

# Extract rpm (we're already in $PKG) and fix ownership/permissions
rpm2cpio < $CWD/google-desktop-linux-$VERSION.rpm | cpio -imdv || exit 1
chown -R root:root .

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc

/sbin/makepkg -c y -l y $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz
